import 'dart:math';
import 'dart:ui';

import 'package:flutter/material.dart';

class UIData {
  //routes
  static const String Rsplash = "/splash";
  static const String Rindex = "/index";
  static const String Rhome = "/home";
  static const String Rlogin = "/login";
  static const String Rsetting = "/setting";
  static const String Rorder = "/order";
  static const String Rmsg = "/msg";
  static const String Rflow = "/flow";
  static const String RTakeaway = "/takeaway";
  static const String RPresentation= "/presentation";

  //strings
  static const String appName = "客利得";
  static const String loadingText = "小客正在努力加载中...";

  //fonts
  static const String quickFont = "Quicksand";
  static const String ralewayFont = "Raleway";
  static const String quickBoldFont = "Quicksand_Bold.otf";
  static const String quickNormalFont = "Quicksand_Book.otf";
  static const String quickLightFont = "Quicksand_Light.otf";

  //images
  static const String imageDir = "assets/images";
  static const String avatar = "$imageDir/avatar.png";
  static const String checkCirclePurple = "$imageDir/check-circle-purple.png";
  static const String checkCircleGreen = "$imageDir/check-circle-green.png";

  static String langCode2Text(value) {
    String _text = '';
    switch(value) {
      case 'zh':
        _text = '简体中文';
        break;
      case 'en':
        _text = 'English';
        break;
      default:
        _text = 'English';
    }
    return _text;
  }

  static String orderSource2Text(value) {
    String _text = '';
    switch(value) {
      case 'QRCODE':
        _text = '扫码点餐';
        break;
      case 'POS':
        _text = 'APP点餐';
        break;
      default:
        _text = value;
    }
    return _text;
  }

  static const double leftMenuWidth = 80.0;
  static const double cartWidth = 360.0;
  static const double headerHeight = 50.0;
  static const MaterialColor ui_kit_color = Colors.grey;
  static const Color primaryColor = Color.fromRGBO(143, 148, 251, 1);
  static const Color bgColor = Color(0xff141F2F);
  static const Color drawerBgColor = Color(0xff233142);
  static const Color drawerBoarderColor = Color(0xff2e3c4c);
  static const Color drawerBtnColor = Color(0xff394655);
  static const Color mainBackgroundColor = Color.fromRGBO(241, 242, 241, 1);
  static const Color white = Colors.white;
  static const Color black = Color(0xff000000);
  static const Color menuActive = Color(0xff00A0E9);
  static const Color red = Colors.red;
  static const Color green = Color(0xff4ecc6b);
  static const double textActionSize = 15.0;
  static const Color textNormal = Color(0xff323233);
  static const Color textGrey = Color(0XFF6E6E6E);
  static const Color textSub = Color(0xff808080);
  static const Color textBN = Color(0xff222222);
  static const Color textGL = Color(0xffb9b9b9);
  static const Color textGN = Color(0xffAAAAAA);
  static const Color textGD = Color(0xff666666);
  static const Color textGca = Color(0xffCACACA);
  static const Color textB37 = Color(0xff373737);
  static const Color textTitleGD = Color(0xff444444);
  static const Color windowBg = Color(0xfff8f8f8);
  static const Color divideBg = Color(0xffdcdcdc);
  static const Color lineBg = Color(0xffEDEDED);
  static const double lineH = 0.5;
  static const double menuH = 50.0;
  static const double lineHB = 0.6;
  static const double dividerH = 1.0;
  static const Color fansYellow = Color(0xffE4AC25);
  static const Color gradientStart = Color(0xff494949);
  static const Color gradientEnd = Color(0xff605d60);
  static const Gradient primaryGradient = const LinearGradient(colors: [gradientStart, gradientEnd]);
  static const Gradient sortGradient = const LinearGradient(colors: [Color(0xffFFA0B4), Color(0xffFD3962)]);
  static const Color searchAppBarBgColor = Color(0xFFFFFFFF);
  static const Color whiteGray = Color(0xfff5f5f5);

  static const TextStyle tsSGLTag = TextStyle(color: UIData.textGL, fontSize: 12);
  static const TextStyle tsSGNTag = TextStyle(color: UIData.textGL, fontSize: 14);

  static const TextStyle tsSGNTitle = TextStyle(color: UIData.textGN, fontSize: 14);
  static const TextStyle tsBTitleNormal = TextStyle(color: Colors.black, fontSize: 18);

  static const TextStyle tsSGNTitleBigger = TextStyle(color: UIData.textGN, fontSize: 16);

  static const TextStyle tsRaiseTitleN =  TextStyle(fontSize: 16, color: UIData.white);

  static const TextStyle appBarTitleBlackTextStyle = TextStyle(fontSize: 16, color: Colors.black);

  static const TextStyle productTitleStyle = TextStyle(fontSize: 11.5, color: UIData.textNormal);
  static const TextStyle productPriceStyle = TextStyle(fontSize: 13.5, color: Color(0xff867750), fontWeight: FontWeight.w500);
  static const TextStyle uploadTitleStyle = TextStyle(color: UIData.textNormal, fontSize: 16.0);

  static const double raiseHN = 40.0;

//colors
  static List<Color> kitGradients = [
    // new Color.fromRGBO(103, 218, 255, 1.0),
    // new Color.fromRGBO(3, 169, 244, 1.0),
    // new Color.fromRGBO(0, 122, 193, 1.0),
    Colors.blueGrey.shade800,
    Colors.black87,
  ];
  static List<Color> kitGradients2 = [
    Colors.cyan.shade600,
    Colors.blue.shade900
  ];

  //randomcolor
  static final Random _random = new Random();

  /// Returns a random color.
  static Color next() {
    return new Color(0xFF000000 + _random.nextInt(0x00FFFFFF));
  }
}

class IconFonts {
  IconFonts._();

  /// iconfont:flutter base
  static const String fontFamily = 'iconfont';

  static const IconData pageEmpty = IconData(0xe63c, fontFamily: fontFamily);
  static const IconData pageError = IconData(0xe600, fontFamily: fontFamily);
  static const IconData pageNetworkError = IconData(0xe678, fontFamily: fontFamily);
  static const IconData pageUnAuth = IconData(0xe65f, fontFamily: fontFamily);
}
